package m.jclecai.com.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;

import java.util.List;

import m.jclecai.com.R;
import m.jclecai.com.adapter.holder.RmfamousListHolder;
import m.jclecai.com.bean.reconmend.ReconmentPerson;
import m.jclecai.com.listener.Callback;

/**
 * Created by ZD on 2017/7/19.
 */

public class RmfamousListAdapter extends RecyclerView.Adapter<RmfamousListHolder> {

    private Context mContext;
    private Callback mCallback;
    private List<ReconmentPerson> records;
    public RmfamousListAdapter(Context mContext,List<ReconmentPerson> records) {
        this.mContext = mContext;
        this.records = records;
    }

    @Override
    public RmfamousListHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        return new RmfamousListHolder(View.inflate(mContext, R.layout.item_rm_list,null));
    }

    @Override
    public void onBindViewHolder(RmfamousListHolder holder, int position) {
        holder.init(mCallback,records.get(position));
    }

    @Override
    public int getItemCount() {
        return records.size();
    }

    public void setmCallback(Callback mCallback) {
        this.mCallback = mCallback;
    }
}
